/*     */ package com.qmsk.business.informake.infoType.controller;
/*     */ 
/*     */ import com.qmsk.business.shopList.ShopMap;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.http.HttpGsonPtResponseUtils;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"ptInfoType"})
/*     */ public class InfoTypeController
/*     */ {
/*  24 */   private static final Logger logger = Logger.getLogger(InfoTypeController.class);
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/opt/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  41 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  43 */       String sData = "";
/*  44 */       String sUrl = "ptInfoType/find/shopId/" + ShopMap.getOutIdOfShopId(shopId) + "/opt/" + nPageIdx + "/" + nPageSize;
/*  45 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl, sData, response);
/*  46 */       if ((rst != null) && (rst.getState() == 0)) {
/*  47 */         ResponseUtils.setResponseResult(rst, response);
/*  48 */         return; }
/*  49 */       ResponseUtils.setSqlResultResponse(0, 
/*  50 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  51 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  54 */       logger.error(e);
/*  55 */       ResponseUtils.setErrorMsgResponse(
/*  56 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListId(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id, @PathVariable("shopId") Long shopId)
/*     */   {
/*     */     try
/*     */     {
/*  65 */       String sData = "";
/*  66 */       String sUrl = "ptInfoType/find/shopId/" + ShopMap.getOutIdOfShopId(shopId) + "/id/" + id;
/*  67 */       GsonEbRst rst = HttpGsonPtResponseUtils.getPtEbRst(sUrl, sData, 
/*  68 */         response);
/*  69 */       if ((rst != null) && (rst.getState() == 0)) {
/*  70 */         ResponseUtils.setResponseResult(rst, response);
/*  71 */         return; }
/*  72 */       ResponseUtils.setSqlResultResponse(0, 
/*  73 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  74 */         response);
/*     */     }
/*     */     catch (Exception e) {
/*  77 */       logger.error(e);
/*  78 */       ResponseUtils.setErrorMsgResponse(
/*  79 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*  96 */     String sGsonInData = RequestUtils.getString(request, "data");
/*     */     try {
/*  98 */       String sData = "data=" + sGsonInData;
/*  99 */       String sUrl = "ptInfoType/insert/shopId/" + ShopMap.getOutIdOfShopId(shopId);
/* 100 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 101 */         response);
/* 102 */       if ((rst != null) && (rst.getState() == 0)) {
/* 103 */         ResponseUtils.setResponseResult(rst, response);
/* 104 */         return; }
/* 105 */       ResponseUtils.setSqlResultResponse(0, 
/* 106 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 107 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 110 */       logger.error(e);
/* 111 */       ResponseUtils.setErrorMsgResponse(
/* 112 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 113 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 130 */     String sGsonInData = RequestUtils.getString(request, "data");
/*     */     try {
/* 132 */       String sData = "data=" + sGsonInData;
/* 133 */       String sUrl = "ptInfoType/edit/shopId/" + ShopMap.getOutIdOfShopId(shopId);
/* 134 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 135 */         response);
/* 136 */       if ((rst != null) && (rst.getState() == 0)) {
/* 137 */         ResponseUtils.setResponseResult(rst, response);
/* 138 */         return; }
/* 139 */       ResponseUtils.setSqlResultResponse(0, 
/* 140 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/* 141 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 144 */       logger.error(e);
/* 145 */       ResponseUtils.setErrorMsgResponse(
/* 146 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 147 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 164 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 166 */       String sData = "id=" + id;
/* 167 */       String sUrl = "ptInfoType/del/shopId/" + ShopMap.getOutIdOfShopId(shopId);
/* 168 */       GsonEbRst rst = HttpGsonPtResponseUtils.postPtEbRst(sUrl, sData, 
/* 169 */         response);
/* 170 */       if ((rst != null) && (rst.getState() == 0)) {
/* 171 */         ResponseUtils.setResponseResult(rst, response);
/* 172 */         return; }
/* 173 */       ResponseUtils.setSqlResultResponse(0, 
/* 174 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 175 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 178 */       logger.error(e);
/* 179 */       ResponseUtils.setErrorMsgResponse(
/* 180 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 181 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.informake.infoType.controller.InfoTypeController
 * JD-Core Version:    0.5.3
 */